/**************************
Replication file for: 
Johnson, Joel W. and Ver�nica Hoyo. (2012) 
�Beyond Personal Vote Incentives: Dividing the Vote in Preferential Electoral Systems.� 
Electoral Studies, 31(1): pp. 131-142.

Uses dataset:  "VoteDivision.dta". 
**************************/


clear
* local path "--input path here--VoteDivision.dta" 
use "`path'xnat_incumbency.dta"




****BOX PLOT DSHARE -- 2-INC COHORTS 
replace include = 1
replace include = 0 if country=="Switzerland (by list)"
replace include = 0 if country=="Finland (by list)"
replace include = 0 if country=="Brazil (by list)"
graph hbox MaxVShareDeviation if n_subslate==2 & include==1, /* 
*/ medtype(line) over(country2, sort(median_MaxVShare) label(angle(horizontal))) nofill nooutside /*
*/ ytitle(" " "DSHARE: Inequality in Vote Shares" " ", size(medlarge)) /*
*/ note("") caption("") /*
*/ graphregion(fcolor(white)) 


****BOX PLOT DSHARE -- 3-INC COHORTS 
replace include = 1
replace include = 0 if country=="Switzerland (by list)"
replace include = 0 if country=="Finland (by list)"
replace include = 0 if country=="Brazil (by list)"
graph hbox MaxVShareDeviation if n_subslate==3 & include==1, /* 
*/ medtype(line) over(country2, sort(median_MaxVShare) label(angle(horizontal))) nofill nooutside /*
*/ ytitle(" " "DSHARE: Inequality in Vote Shares" " ", size(medlarge)) /*
*/ ylabel(0 .1 .2 .3 .4 .5) /*
*/ note("") caption("") /*
*/ graphregion(fcolor(white)) 


/**** GRAPH:  JAPAN and BRAZIL;  NINC=3*/
replace include = 0 
replace include = 1 if n_subslate==3
twoway (scatter MaxVoteDeviation_inSubslate vote_subslate if include==1 & country=="Japan", mcolor(gs12) msymbol(+) msize(medsmall) text(80000 400000 "Brazil") text(36000 390000 "Japan")) /*	
*/ (scatter MaxVoteDeviation_inSubslate vote_subslate if include==1 & country=="Brazil (by party)", mcolor(black) msymbol(circle) msize(medsmall)) /*	
*/ (lfit MaxVoteDeviation_inSubslate vote_subslate if include==1 & country=="Brazil (by party)", lcolor(black) lpattern(solid) lwidth(thick))  /*
*/ (lfit MaxVoteDeviation_inSubslate vote_subslate if include==1 & country=="Japan", lcolor(gs8) lpattern(solid) lwidth(thick)), /*
*/ xtitle(" " "Cohort's Total Votes" " ") /*
*/ xlabel(0(100000)400000 , format(%9.0gc)) /*
*/ ylabel(, angle(horizontal) format(%9.0gc)) /*
*/ ytitle("DVOTE:" "Vote Inequality" "Within Cohort", orientation(horizontal)) /*
*/ graphregion(fcolor(white)) /*
*/ legend(off)


/**** GRAPH:  Ireland and Finland;  NINC=2*/
replace include = 0 
replace include = 1 if n_subslate==2
twoway (scatter MaxVoteDeviation_inSubslate vote_subslate if include==1 & country=="Ireland", mcolor(gs11) msymbol(+) msize(medsmall) text(5000 23000 "Finland") text(2770 24800 "Ireland")) /*	
*/ (scatter MaxVoteDeviation_inSubslate vote_subslate if include==1 & country=="Finland (by party)", mcolor(black) msymbol(circle) msize(medsmall)) /*	
*/ (lfit MaxVoteDeviation_inSubslate vote_subslate if include==1 & country=="Finland (by party)", lcolor(black) lpattern(solid) lwidth(thick))  /*
*/ (lfit MaxVoteDeviation_inSubslate vote_subslate if include==1 & country=="Ireland", lcolor(gs9) lpattern("--##") lwidth(thick)), /*
*/ xtitle(" " "Cohort's Total Votes" " ") /*
*/ xlabel(, format(%9.0gc)) /*
*/ ylabel(, angle(horizontal) format(%9.0gc)) /*
*/ ytitle("DVOTE:" "Vote Inequality" "Within Cohort", orientation(horizontal)) /*
*/ graphregion(fcolor(white)) /*
*/ legend(off)



/****************************************
****************************************
DSHARE log_MVSD -- REGRESSION
H1: greater vote equality within Japanese cohorts than within Colombian cohorts 
H2: within Irish cohorts than within Maltese cohorts 
H3: within Japanese cohorts than within Irish cohorts 
H4: within Japanese and Irish cohorts than within OLPR cohorts 
***********/

/** Japan vs. Colombia regression **/
replace include = 0
replace include = 1 if country=="Japan" | country=="Colombia"
replace include = 0 if n_inc >3
reg log_MVSD Japan VShareSubslate_ofDist n_subslate if include==1, robust
outreg2 Japan VShareSubslate_ofDist n_subslate using inc_results, replace 2aster bdec(2)

/** Ireland v. Malta regression **/
replace include = 0
replace include = 1 if country=="Malta" | country=="Ireland"
replace include = 0 if n_inc >3
reg log_MVSD Ireland VShareSubslate_ofDist n_subslate if include==1, robust
outreg2 Ireland VShareSubslate_ofDist n_subslate using inc_results, append 2aster bdec(2)


/** Ireland v. Japan regression **/
replace include = 0
replace include = 1 if country=="Ireland" | country=="Japan"
replace include = 0 if n_inc >3
reg log_MVSD Japan VShareSubslate_ofDist n_subslate if include==1, robust
outreg2 Japan VShareSubslate_ofDist n_subslate using inc_results, append 2aster bdec(2)


/** Japan & Ireland vs. OLPR **/
replace include = 0
replace include = 1 if country=="Japan" | country=="Ireland" | OLPR==1
replace include = 0 if n_inc >3
reg log_MVSD Japan Ireland VShareSubslate_ofDist n_subslate if include==1, robust
outreg2 Japan Ireland VShareSubslate_ofDist n_subslate using inc_results, append 2aster bdec(2)






/****************************************
2nd set of regressions - INTERACTION with NO CONSTANT
****************************************
DVOTE -- REGRESSION
H1: greater vote equality within Japanese cohorts than within Colombian cohorts 
H2: within Irish cohorts than within Maltese cohorts 
H3: within Japanese cohorts than within Irish cohorts 
H4: within Japanese and Irish cohorts than within OLPR cohorts 
***********/


/** Japan v. Colombia **/
replace include = 0
replace include = 1 if country=="Japan" | country=="Colombia"
replace include = 0 if n_inc >3
	/* next reg sig at p<.1 */
reg MaxVoteDeviation_inSubslate J_THvote THvote_subslate if include==1, noconst robust
reg MaxVoteDeviation_inSubslate J_THvote THvote_subslate if include==1 & n_subslate==2, noconst robust
outreg2 J_THvote THvote_subslate using inc_results, replace 10pct 
tab Japan if e(sample) 	/* n col = 10; n jap = 583 */
	reg MaxVoteDeviation_inSubslate J_THvote THvote_subslate if include==1 & n_subslate==3, noconst robust
	tab Japan if e(sample) /* n col = 1 */
	reg MaxVoteDeviation_inSubslate J_THvote THvote_subslate if include==1, noconst robust


/** Japan v. Switzerland  **/
replace include = 0
replace include = 1 if country=="Japan" | country=="Switzerland (by party)"
replace include = 0 if n_inc >3
replace include = 0 if Japan==0 & THvote_subslate>250 /* drops one obs w high leverage*/
reg MaxVoteDeviation_inSubslate J_THvote THvote_subslate if include==1, noconst robust
outreg2 J_THvote THvote_subslate using inc_results, append 
reg MaxVoteDeviation_inSubslate J_THvote THvote_subslate if include==1 & n_subslate==2, noconst robust
outreg2 J_THvote THvote_subslate using inc_results, append 
tab Japan if e(sample)	/* N = 54 to 583 */
reg MaxVoteDeviation_inSubslate J_THvote THvote_subslate if include==1 & n_subslate==3, noconst robust
outreg2 J_THvote THvote_subslate using inc_results, append 
tab Japan if e(sample)	/* N 18 to 353 (j) */



/** Japan v. Brazil **/
replace include = 0
replace include = 1 if country=="Japan" | country=="Brazil (by party)"
replace include = 0 if n_inc >3
reg MaxVoteDeviation_inSubslate J_THvote THvote_subslate if include==1, noconst robust
outreg2 J_THvote THvote_subslate n_subslate using inc_results, append 10pct 
reg MaxVoteDeviation_inSubslate J_THvote THvote_subslate if include==1 & n_subslate==2, noconst robust
outreg2 J_THvote THvote_subslate n_subslate using inc_results, append 10pct 
	tab Japan if e(sample)
reg MaxVoteDeviation_inSubslate J_THvote THvote_subslate if include==1 & n_subslate==3, noconst robust
outreg2 J_THvote THvote_subslate n_subslate using inc_results, append 10pct 
	tab Japan if e(sample)
	reg MaxVoteDeviation_inSubslate J_THvote THvote_subslate n_subslate if include==1, noconst robust


/** Ireland v. Malta **/
replace include = 0
replace include = 1 if country=="Ireland" | country=="Malta"
replace include = 0 if n_inc >3
reg MaxVoteDeviation_inSubslate I_THvote THvote_subslate if include==1, noconst robust
outreg2 I_THvote THvote_subslate n_subslate using inc_results, append 10pct 
	/* next reg not sig (p=.144), but only 7 malta obs */
reg MaxVoteDeviation_inSubslate I_THvote THvote_subslate if include==1 & n_subslate==2, noconst robust
outreg2 I_THvote THvote_subslate n_subslate using inc_results, append 10pct 
	tab Ireland if e(sample)
reg MaxVoteDeviation_inSubslate I_THvote THvote_subslate if include==1 & n_subslate==3, noconst robust
outreg2 I_THvote THvote_subslate n_subslate using inc_results, append 10pct 
	tab Ireland if e(sample)
	reg MaxVoteDeviation_inSubslate I_THvote THvote_subslate n_subslate if include==1, noconst robust


/** Ireland v. Finland **/
replace include = 0
replace include = 1 if country=="Ireland" | country=="Finland (by party)"
replace include = 0 if n_inc >3
reg MaxVoteDeviation_inSubslate I_THvote THvote_subslate if include==1, noconst robust
outreg2 I_THvote THvote_subslate n_subslate using inc_results, append 10pct 
reg MaxVoteDeviation_inSubslate I_THvote THvote_subslate if include==1 & n_subslate==2, noconst robust
outreg2 I_THvote THvote_subslate n_subslate using inc_results, append 10pct 
tab Ireland if e(sample)
/* next reg not sig, but only 42 obs */
reg MaxVoteDeviation_inSubslate I_THvote THvote_subslate if include==1 & n_subslate==3, noconst robust
outreg2 I_THvote THvote_subslate n_subslate using inc_results, append 10pct 
	tab Ireland if e(sample)
	reg MaxVoteDeviation_inSubslate I_THvote THvote_subslate n_subslate if include==1, noconst robust




